import {inject, Injectable} from '@angular/core';
import {LogService} from './log-service.service';

@Injectable({
  providedIn: 'root',
})
export class LocalStorageService {
  private log: LogService = inject(LogService)

  constructor() {
  }

  get(key: string):string|null {
    return localStorage.getItem(key);
  }



  set(key: string, value: string) {
    var json = JSON.stringify(value);
    localStorage.setItem(key, json);
    this.log.log(' the storage store =', json);
  }

  remove(key: any) {
    this.log.log(' the storage remove =', key);
    localStorage.removeItem(key);
  }

  // 原文链接：https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/105825998
}
